package cn.wsalix.templet.repository;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import cn.anlaser.repository.SimpleRepository;
import cn.wsalix.templet.entity.ProSiteTemplet;

public interface ProSiteTempletRepository extends
		SimpleRepository<ProSiteTemplet> {
	@Query("select u from ProSiteTemplet u where u.project.id = :projectId")
	List<ProSiteTemplet> findByProjectId(@Param("projectId") Long projectId);

	@Query("select u from ProSiteTemplet u where u.proSiteCode = :proSiteCode")
	ProSiteTemplet findByProSiteCode(@Param("proSiteCode") String proSiteCode);

	@Query("select u from ProSiteTemplet u where u.project.id = :projectId and u.proSiteCode = :proSiteCode")
	ProSiteTemplet findByIdAndCode(@Param("proSiteCode") Long projectId,
			@Param("proSiteCode") String proSiteCode);

	@Query("select u from ProSiteTemplet u where u.siteTemplet.id = :stId ")
	List<ProSiteTemplet> findByStId(@Param("stId") Long stId);

	@Query("select u from ProSiteTemplet u where u.siteInfo.id = :siteId ")
	ProSiteTemplet findBySiteIdOne(@Param("siteId") Long siteId);

/*	@Modifying
	@Transactional
	@Query("delete from ProSiteTemplet a where a.siteInfo = ?1")
	public void deleteBySite(SiteInfo siteInfo);
*/
}
